<!DOCTYPE html>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script>
var jsTestIsAsync = true;
function runTest() {
  var frame = document.body.appendChild(document.createElement("iframe"));
  frame.src = "http://localhost:8000/security/resources/opened-document-security-origin-resets-on-navigation-frame.html";
  frame.onload = function () {
    frame.onload = null;
    var blob = new Blob(["<script>(" + function () {
      frame = document.documentElement.appendChild(document.createElement("iframe"));
      frame.contentWindow.setTimeout("parent.document.open()", 0);
      setTimeout(function () {
          location = "javascript:'<script>setTimeout(top.finishJSTest, 0); parent.eval(\"alert(location)\"); top.testFailed(\"context security origin was not updated!\");</scr" + "ipt>'" }, 0);
    } + "())</sc" + "ript>"], {type: "text/html"});
    frame.contentWindow[0].location = URL.createObjectURL(blob);
  }
}
</script>
</head>
<body onload="runTest()">
</body>
</html>
